package com.wd.live.view.activity

import android.content.Intent
import androidx.fragment.app.Fragment

import androidx.fragment.app.FragmentStatePagerAdapter
import com.wd.live.databinding.ActivitySexBinding

import com.wd.live.model.base.BaseActivity
import com.wd.live.model.base.BaseViewModel
import com.wd.live.view.fragment.LableFragment
import com.wd.live.view.fragment.XingZuoFragment
import com.wd.live.view.fragment.SexFragment
/**
 * 作者：马海钊
 * 时间：2023/8/16 15:37
 * 功能：个人资料页
 */
class SexActivity : BaseActivity<BaseViewModel, ActivitySexBinding>() {
    private val List: MutableList<Fragment> = ArrayList()
//    private val title = arrayOf("", "", "")
//    private val img = intArrayOf(R.mipmap.pro01, R.mipmap.pro02, R.mipmap.pro02)

    override fun initData() {
        List.add(SexFragment())
        List.add(XingZuoFragment())
        List.add(LableFragment())

        binding.viewPager.offscreenPageLimit = List.size;
        binding.viewPager.adapter = object : FragmentStatePagerAdapter(supportFragmentManager) {
            override fun getCount(): Int {
                return List.size
            }

            override fun getItem(position: Int): Fragment {

                return List[position]
            }
        }
        binding.tabLayout.setupWithViewPager(binding.viewPager)
        binding.tabLayout.getTabAt(0)?.select()
        binding.SexTiao.setOnClickListener {
            startActivity(Intent(this,HomeActivity::class.java))
        }
    }

    override fun getViewBinding() = ActivitySexBinding.inflate(layoutInflater)
    override fun onDestroy() {
        super.onDestroy()
        binding.tabLayout.removeAllViews()
    }
}